**Moriah Harman, Redistributive Policy Preferences: The Effects of Family Income and Poverty Attributions, Data Replication

**Data cleaning commands

**DV1
gen raisewealthytax = taxdoug_2019
recode raisewealthytax 8 = .
recode raisewealthytax 3 = .
tab raisewealthytax
sum raisewealthytax
recode raisewealthytax 2 = 0
label variable raisewealthytax "raise taxes for the wealthy (2019)
label define raisewealthytax 0 "no" 1 "yes"
label values raisewealthytax raisewealthytax

**DV2
gen taxcreditsforlowincome = econpolicy_taxcredit_2019Jan
recode taxcreditsforlowincome 8 = .
**now i want to reverse the order so that the lowest value is strongly oppose
tab taxcreditsforlowincome 
sum taxcreditsforlowincome
replace taxcreditsforlowincome = abs(taxcreditsforlowincome-5) 
label variable taxcreditsforlowincome "support policy-providing tax credits for lower-income workers(2019)"
label define taxcreditsforlowincome 0 "strongly oppose" 1 "somewhat oppose" 2 "neither support nor oppose" 3 "somewhat support" 4 "strongly support"
label values taxcreditsforlowincome taxcreditsforlowincome


**why people are poor items (8 = skipped)

gen poorhardwork = explainpoor_workhard_2019Jan
recode poorhardwork 8 = . 
replace poorhardwork = abs(poorhardwork-5) 
label variable poorhardwork "Importance of explanations for why people are poor -- they don't work hard enough"
label define poorhardwork 0 "not important at all" 1 "not very important" 2 "fairly important" 3 "very important" 4 "extremely important"
label values poorhardwork poorhardwork 

gen poorunfair = explainpoor_unfair_2019Jan
recode poorunfair 8 = . 
replace poorunfair = abs(poorunfair-5) 
label variable poorunfair "Importance of explanations for why people are poor -- unfair economic system"
label define poorunfair 0 "not important at all" 1 "not very important" 2 "fairly important" 3 "very important" 4 "extremely important"
label values poorunfair poorunfair

gen poordiscrim = explainpoor_discrim_2019Jan
recode poordiscrim 8 = . 
replace poordiscrim = abs(poordiscrim-5) 
label variable poordiscrim "Importance of explanations for why people are poor -- they face discrimination"
label define poordiscrim 0 "not important at all" 1 "not very important" 2 "fairly important" 3 "very important" 4 "extremely important"
label values poordiscrim poordiscrim

gen poornotresp = explainpoor_notresp_2019Jan
recode poornotresp 8 = . 
replace poornotresp = abs(poornotresp-5) 
label variable poornotresp "Importance of explanations for why people are poor -- not spending money responsibly"
label define poornotresp 0 "not important at all" 1 "not very important" 2 "fairly important" 3 "very important" 4 "extremely important"
label values poornotresp poornotresp

gen poorbadluck = explainpoor_luck_2019Jan
recode poorbadluck 8 = . 
replace poorbadluck = abs(poorbadluck-5) 
label variable poorbadluck "Importance of explanations for why people are poor -- they have bad luck"
label define poorbadluck 0 "not important at all" 1 "not very important" 2 "fairly important" 3 "very important" 4 "extremely important"
label values poorbadluck poorbadluck 

gen poortalent = explainpoor_talent_2019Jan
recode poortalent 8 = . 
replace poortalent = abs(poortalent-5) 
label variable poortalent "Importance of explanations for why people are poor -- don't have the right talent"
label define poortalent 0 "not important at all" 1 "not very important" 2 "fairly important" 3 "very important" 4 "extremely important"
label values poortalent poortalent 


**Now, to run factor analysis to create my poverty attributions variable (based on the 6 items for each that I started with)
**First round factor analysis using all six poor variables:
factor poorhardwork poorunfair poordiscrim poornotresp poorbadluck poortalent, pcf

**second round factor analysis using first four poor variables and generating fpoverty1, followed by second round factor analysis using 2 other poor variables//
**to generate fpoverty2
factor poorhardwork poorunfair poordiscrim poornotresp, pcf
predict fpoverty1

factor poorbadluck poortalent, pcf
predict fpoverty2

label variable fpoverty1 "Scores for factor 1 (main poor explanation scale - low internal, high external)"
label values fpoverty1 fpoverty1 

**I use fpoverty1 in my analysis

**Cleaning control variables:
**church/religious service attendance:
gen chattend19 = religservice_2019Jan
recode chattend19 8 = .
recode chattend19 7 = .
replace chattend19 = abs(chattend19-6)
label variable chattend19 "church/religious service attendance 2019"
label define chattend19 0 "never" 1 "seldom" 2 "a few times a year" 3 "once or twice a month" 4 "once a week" 5 "more than once a week"
label values chattend19 chattend19

**highest level of education completed:
gen educ19 = educ_2019Jan
replace educ19 = educ19 - 1
label variable educ19 "highest level of education completed"
label define educ19 0 "no HS" 1 "HS grad" 2 "some college" 3 "2-year" 4 "4-year" 5 "post-grad" 
label values educ19 educ19

**Family (annual) income
gen famincome19 = faminc_2019Jan
recode famincome19 98 = . 
recode famincome 97 = .
replace famincome19 = famincome19 - 1
label variable famincome19 "family annual income, 2019"
label define famincome19 0 "less than $10k" 1 "$10k-19,999" 2 "$20k-29,999" 3 "$30k-39,999" 4 "$40k-49,999" 5 "$50k-59,999" 6 "$60k-69,999" 7 "$70k-79,999" 8 "$80k-99,999" 9 "$100k-119,999" 10 "$120k-149,999" 11 "$150k-199,999" 12 "$200k-249,999" 13 "$250k-349,999" 14 "$350k-499,999" 15 "$500k or more"
label values famincome19 famincome19 

**perceptions of the economy:
gen econtrend19 = econtrend_2019Jan
recode econtrend19 4 = .
recode econtrend19 8 = .
replace econtrend19 = econtrend19 - 1
replace econtrend19 = econtrend19 - 1
recode econtrend19 -1 = 2
recode econtrend19 1 = -1 
recode econtrend19 2 = 1
label variable econtrend19 "do you think the economy is getting better or worse?"
label define econtrend19 -1 "getting worse" 0 "about the same" 1 "getting better"
label values econtrend19 econtrend19


**ideology
gen libcon = ideo5_2019Jan
recode libcon 6 = .
recode libcon 8 = .
replace libcon = libcon - 1
**now it ranges from 0 (very liberal) to 4 (very conservative)
label variable libcon "political ideology"
label define libcon 0 "very liberal" 1 "liberal" 2 "moderate" 3 "conservative" 4 "very conservative"
label values libcon libcon

**7-point Party ID
gen partyid = pid7_2019Jan
recode partyid 8 = .
replace partyid = partyid - 1 
**now it ranges from 0 to 6
label variable partyid "7 point party ID"
label define partyid 0 "strong Democrat" 1 "not very strong Democrat" 2 "Lean Democrat" 3 "Independent" 4 "Lean Republican" 5 "Not very strong Republican" 6 "Strong Republican"
label values partyid partyid

**Political Interest
gen polinterest19 = newsint_2019Jan
tab polinterest19
recode polinterest19 0 = .
recode polinterest19 8 = .
recode polinterest19 7 = .
replace polinterest19 = abs(polinterest19-4) 
label variable polinterest19 "pol interest: how often do you follow what's going on in gov and public affairs?"
label define polinterest19 0 "hardly at all" 1 "only now and then" 2 "some of the time" 3 "most of the time"
label values polinterest19 polinterest19
**ranges from 0 to 3 now

**Age
gen age19 = 2019 - birthyr_2019Jan
sum age19
label variable age19 "Age in years, as of 2019"

**Gender
gen gender19 = gender_2019Jan
replace gender1 = gender19 - 1
**now it ranges from 0 to 1
label variable gender19 "Gender, 2019"
label define gender19 0 "male" 1 "female"
label values gender19 gender19

**Race
sum race_2019Jan
tab race_2019Jan
**white = 5041; Black = 515; Hispanic = 601; Asian = 326; Native American = 48; Mixed = 143; Other = 95; Middle Eastern = 10
gen race19 = race_2019Jan
label variable race19 "Race/Ethnicity, 2019"
label define race19 1 "White" 2 "Black" 3 "Hispanic" 4 "Asian" 5 "Native American" 6 "Mixed" 7 "Other" 8 "Middle Eastern" 
label values race19 race19

**Now, to make dichotomous variables based on those categories

gen white = 0
recode white 0 = 1 if race19 == 1
recode white 0 = . if race19 == .
tab white
sum white
label variable white "White respondent"
label define white 0 "no" 1 "yes"
label values white white

gen black = 0
recode black 0 = 1 if race19 == 2
recode black 0 = . if race19 == .
label variable black "Black respondent"
label define black 0 "no" 1 "yes"
label values black black
sum black
tab black

gen hispanic = 0
recode hispanic 0 = 1 if race19 == 3
recode hispanic 0 = . if race19 == .
label variable hispanic "Hispanic respondent"
label define hispanic 0 "no" 1 "yes"
label values hispanic hispanic
tab hispanic
sum hispanic

gen asian = 0
recode asian 0 = 1 if race19 == 4
recode asian 0 = . if race19 == .
label variable asian "Asian respondent"
label define asian 0 "no" 1 "yes"
label values asian asian
tab asian
sum asian

gen nativeamerican = 0
recode nativeamerican 0 = 1 if race19 == 5
recode nativeamerican 0 = . if race19 == .
label variable nativeamerican "Native American respondent"
label define nativeamerican 0 "no" 1 "yes"
label values nativeamerican nativeamerican
tab nativeamerican
sum nativeamerican

gen mixedrace = 0 
recode mixedrace 0 = 1 if race19 == 6
recode mixedrace 0 = . if race19 == .
label variable mixedrace "Mixed race respondent"
label define mixedrace 0 "no" 1 "yes"
label values mixedrace mixedrace
tab mixedrace
sum mixedrace

gen otherrace = 0
recode otherrace 0 = 1 if race19 == 7
recode otherrace 0 = . if race19 == .
label variable otherrace "Other race respondent"
label define otherrace 0 "no" 1 "yes"
label values otherrace otherrace
tab otherrace
sum otherrace

gen middleeastern = 0
recode middleeastern 0 = 1 if race19 == 8
recode middleeastern 0 = . if race19 == .
label variable middleeastern "Middle Eastern respondent"
label define middleeastern 0 "no" 1 "yes"
label values middleeastern middleeastern
tab middleeastern
sum middleeastern
